﻿<Window x:Class="LogicCircuit.DialogMessage"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:lc="clr-namespace:LogicCircuit"
	xmlns:properties="clr-namespace:LogicCircuit.Properties"
	WindowStartupLocation="CenterOwner"
	Title="{Binding Path=Caption, Mode=OneTime}"
	Style="{StaticResource DialogFixedWindow}"
	MinWidth="340" MinHeight="100"
>
	<lc:AutoGrid>
		<Image Source="{Binding Path=BitmapSource, Mode=OneTime}" Margin="24,24,12,24" VerticalAlignment="Top"/>
		<ScrollViewer Margin="8" VerticalAlignment="Center" HorizontalAlignment="Stretch" MaxHeight="240"
			HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
		>
			<TextBlock Name="message" VerticalAlignment="Center" TextWrapping="Wrap" TextTrimming="None" MaxWidth="620" Margin="3,3,20,3" Padding="0"/>
		</ScrollViewer>

		<TextBox Grid.Column="1" IsReadOnly="True"
			Margin="8" HorizontalAlignment="Stretch"
			MaxWidth="640" MaxHeight="320"
			TextWrapping="WrapWithOverflow"
			HorizontalScrollBarVisibility="Auto"
			VerticalScrollBarVisibility="Auto"
			Text="{Binding Path=Details, Mode=OneTime}"
		>
			<TextBox.Style>
				<Style TargetType="{x:Type TextBox}">
					<Style.Triggers>
						<DataTrigger Binding="{Binding ElementName=showDetails, Path=IsChecked}" Value="True">
							<Setter Property="Visibility" Value="Visible"/>
						</DataTrigger>
						<DataTrigger Binding="{Binding ElementName=showDetails, Path=IsChecked}" Value="False">
							<Setter Property="Visibility" Value="Collapsed"/>
						</DataTrigger>
					</Style.Triggers>
				</Style>
			</TextBox.Style>
		</TextBox>

		<lc:AutoGrid Grid.ColumnSpan="2">
			<CheckBox Name="showDetails" Margin="8" VerticalAlignment="Bottom"
				Content="{x:Static properties:Resources.TitleShowDetails}"
			>
				<CheckBox.Style>
					<Style TargetType="{x:Type CheckBox}" BasedOn="{StaticResource {x:Type CheckBox}}">
						<Style.Triggers>
							<DataTrigger Binding="{Binding Path=Details.Length, Mode=OneTime}" Value="0">
								<Setter Property="Visibility" Value="Collapsed"/>
							</DataTrigger>
						</Style.Triggers>
					</Style>
				</CheckBox.Style>
			</CheckBox>

			<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom">
				<Button Content="{x:Static properties:Resources.TitleOK}" Click="ButtonClick" Name="OK"/>
				<Button Content="{x:Static properties:Resources.TitleYes}" Click="ButtonClick" Name="Yes"/>
				<Button Content="{x:Static properties:Resources.TitleNo}" Click="ButtonClick" Name="No"/>
				<Button Content="{x:Static properties:Resources.TitleCancel}" Click="ButtonClick" Name="Cancel"/>
			</StackPanel>
		</lc:AutoGrid>
	</lc:AutoGrid>
</Window>
